package com.baoyi.adapter;

import java.util.ArrayList;
import java.util.List;

import android.content.Context;
import android.content.Intent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.BaseAdapter;

import com.baoyi.pooke.MonthListUI;
import com.baoyi.pooke.R;
import com.baoyi.pooke.WeekListUI;
import com.baoyi.pooke.YearListUI;
import com.baoyi.widget.BaoButton;

public class ButtonsAdapter extends BaseAdapter {

	private List<BaoButton> buttons;

	public ButtonsAdapter(final Context context) {
		buttons = new ArrayList<BaoButton>();
		BaoButton b1 = new BaoButton(context);
		b1.setImageResource(R.drawable.benzhou);
		b1.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				Intent item = new Intent(context, WeekListUI.class);
				context.startActivity(item);
			}
		});
		buttons.add(b1);
		BaoButton b2 = new BaoButton(context);
		b2.setImageResource(R.drawable.benyue);
		b2.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				Intent item = new Intent(context, MonthListUI.class);
				context.startActivity(item);
			}
		});
		buttons.add(b2);
		BaoButton b3 = new BaoButton(context);
		b3.setImageResource(R.drawable.bennian);
		b3.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				Intent item = new Intent(context, YearListUI.class);
				context.startActivity(item);
			}
		});
		buttons.add(b3);
	}

	@Override
	public int getCount() {
		return buttons.size();
	}

	@Override
	public Object getItem(int position) {
		return null;
	}

	@Override
	public long getItemId(int position) {
		return 0;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		return buttons.get(position);
	}

}
